home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWExcLib / Sources / FWExcept.cpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.9 KB  |  96 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWExcept.cpp
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef   FWEXCEPT_H
  13. #include "FWExcept.h"
  14. #endif
  15.  
  16. #ifndef   FWPRIMEM_H
  17. #include "FWPriMem.h"
  18. #endif
  19.  
  20. #ifndef   FWPRIDEB_H
  21. #include "FWPriDeb.h"
  22. #endif
  23.  
  24. #include <stddef.h>
  25.  
  26. #ifdef FW_BUILD_MAC
  27. #pragma segment BEL
  28. #endif
  29.  
  30. //========================================================================================
  31. // CLASS _FW_CException
  32. //========================================================================================
  33.  
  34. _FW_EXCEPTION_IMPLEMENT_ROOT(_FW_CException)
  35.  
  36. //----------------------------------------------------------------------------------------
  37. // _FW_CException::operator new
  38. //----------------------------------------------------------------------------------------
  39. void* _FW_CException::operator new(size_t    /* size */)
  40. {
  41.     FW_PRIV_ASSERT(FALSE);        // exceptions should be on the stack
  42.     return NULL;
  43. }
  44.  
  45.  
  46. //----------------------------------------------------------------------------------------
  47. // _FW_CException::operator delete
  48. //----------------------------------------------------------------------------------------
  49. void _FW_CException::operator delete(void* /* memory */)
  50. {
  51.     FW_PRIV_ASSERT(FALSE);        // exceptions should be on the stack
  52. }
  53.  
  54. //----------------------------------------------------------------------------------------
  55. // _FW_CException::_FW_CException
  56. //----------------------------------------------------------------------------------------
  57. _FW_CException::_FW_CException()
  58. {
  59. #ifdef FW_DEBUG
  60.     fIsValid = 1;
  61. #endif
  62. }
  63.  
  64. //----------------------------------------------------------------------------------------
  65. // _FW_CException::~_FW_CException
  66. //----------------------------------------------------------------------------------------
  67. _FW_CException::~_FW_CException()
  68. {
  69. #ifdef FW_DEBUG
  70.     FW_PRIV_ASSERT(fIsValid==1);
  71.     fIsValid = 0;
  72. #endif
  73. }
  74.  
  75. //----------------------------------------------------------------------------------------
  76. // _FW_CException::__IsKindOf()
  77. //----------------------------------------------------------------------------------------
  78.  
  79. int _FW_CException::__IsKindOf(FW_ClassReference  aClass)
  80. {
  81.     FW_PRIV_ASSERT(fIsValid==1);
  82.     return PrivVirtualGetClassInfo()->IsKindOf(aClass);
  83. }
  84.  
  85. //----------------------------------------------------------------------------------------
  86. // _FW_CException::Copy(void *p)
  87. //----------------------------------------------------------------------------------------
  88. void _FW_CException::Copy(void *p, size_t maxObjectSize) const
  89. {
  90.     FW_PRIV_ASSERT(fIsValid==1);
  91.     size_t objectSize = GetSize();
  92.     FW_PRIV_ASSERT(objectSize <= maxObjectSize);
  93.     FW_PrimitiveCopyMemory(this, p, objectSize);
  94. }
  95.  
  96.